import request from '@/utils/request'

// export function getRoleList(params) {
//   return request({
//     url: '/sys/role',
//     params // 查询参数
//   })
// }
export const getRoleList = (params) => request.get('/sys/role', { params })

export const addRole = (data) => request.post('/sys/role', data)

export const updataRole = (data) => request.put('/sys/role/' + data.id, data)
/**
 * 删除
 * @param {*} id
 * @returns
 */
export const delRole = id => request.delete('/sys/role/' + id)

export const getRolesEnabled = () => request.get('/sys/role/list/enabled')

// 分配角色

export const assignRoles = (data) => request.put('/sys/role/list/enabled', data)

export const getPermissById = id => request.get('/sys/role/' + id)

/**
 * 给角色分配权限
 *
 * ***/

export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
